<?php
namespace app\common\validate;

use think\Validate;

class UserValidate extends Validate{

    protected $rule = [
        'name'=>'require',    //名称可以相同 因为有分组
        'account'=>'require|unique:user',
        'password'=>'require',
        'role_id'=>'require',
    ];

    protected $message = [
        'name.require'=>'用户名不能为空',
        'account.require'=>'登录账户不能为空',
        'account.unique'=>'登录账号已经存在',
        'role_id.require'=>'必须选择用户角色'
    ];

    protected $scene = [
        'add' => ['name','account','password','role_id'],
        'edit'=> ['name','account','role_id'],
    ];
}